package com.kaifamiao.N0726;

public class Person {
    public String name;
    public char gender;
    public int age;
    public boolean IsMarry;

    public boolean canmarry(Person person){

        if(this.gender == person.gender){
            System.out.println("同性不可以");
            return false;
        }
        if(this.age < 22 || person.age < 20){
            System.out.println("年齡不够，不可以");
            return false;
        }
        if(this.IsMarry == true || person.IsMarry==true){
            System.out.println("有已婚人士，不可以。");
            return false;
        }
        return true;
    }


}
